package fastcsv.tests;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;

public class BufferFileAccessTest {

	public static void main(String[] args) throws Exception {
		test1();
	}

	public static void test1() throws IOException {
		String file9 = ".\\data\\xmap_test.csv.buffer";
		file9 = ".\\data\\xmap_test.csv.buffer";
		file9 = "C:\\data\\wmap_all_16_17_au.csv.buffer";
		File file = new File(file9);
		if(!file.exists())
		{
			System.out.printf("File not exist %s\n", file9);
			return;
		}
		
		RandomAccessFile raf = new RandomAccessFile(file9, "r");
		
		byte[] bts = new byte[(int)raf.length()];
		int len = raf.read(bts);
		System.out.printf("bts.length: %d, read length: %d\n", bts.length, len);
		for(int i = bts.length - 1000; i < bts.length; i++)
		{
			System.out.print(bts[i]&0XFF);
			System.out.print((i + 1) % 100 == 0 ? "\n" : ",");
		}
		
		raf.close();
	}
}
